#4  写函数，统计字符串中有几个字母，几个数字，几个空格，几个其他字符，并返回结果;

def tongji(f):
    a = f.read().split()
    dict = {}
    for k in a:
        if k in dict:
             dict[k] += 1
        else:
             dict[k] = 1
    print(dict)
    f.close()

if __name__ == '__main__':
    f = open(r"C:\Users\徐浬豪\Desktop\shang.txt", encoding="utf-8")
    tongji(f)